<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="resources/compositor-touch-hit-rects.css">
<style>
body {
  /* make it easy to validate rects are covering the entire document */
  height: 1968px;
  margin: 16px 5px;
}
</style>
</head>
<body>
<p id="description">
This tests verifies the hit test regions given to the compositor in the simple case where
touch handles cover (or nearly cover) the entire document. It can only be run in DumpRenderTree.  
</p>

<div id="tests">
</div>

<div id="console"></div>
<script src="resources/compositor-touch-hit-rects.js"></script>
<script>

function runGlobalTest(name, element) {
  // With a global handler, no other handlers should matter
  var elements = [document.getElementById('description'), element, document.getElementById('tests')];
  for (var i = 0; i < elements.length; i++)
    elements[i].addEventListener('touchmove', listener, {passive: false});

  if (window.internals)
    internals.forceCompositingUpdate(document);
  logRects(name, true);

  for (var i = 0; i < elements.length; i++)
    elements[i].removeEventListener('touchmove', listener, {passive: false});
}

function runOverlayTest() {
  if (window.testRunner)
    testRunner.addWebPageOverlay();

  if (window.internals)
    internals.forceCompositingUpdate(document);
  logRects('webPageOverlay', true);

   if (window.testRunner)
    testRunner.removeWebPageOverlay();
}

function additionalTests() {
  runGlobalTest('document', document);
  runGlobalTest('html', document.documentElement);
  runGlobalTest('body', document.body);
  runOverlayTest();
}
</script>
</body>
